﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ServerExplorer.aspx.cs"
    Inherits="WinnerCMS.WebUI.Admin.Explorer.ServerExplorer" %>

<%@ Register Src="../UC_AjaxLoading.ascx" TagName="UC_AjaxLoading" TagPrefix="uc1" %>
<%@ Register Assembly="WinnerCMS.WebControls" Namespace="WinnerCMS.WebControls" TagPrefix="cc1" %>
<!doctype html>
<html>
<head id="Head1" runat="server">
    <title>资源管理器</title>
    <%: Styles.Render("~/Content/Bootstrap/css") %>
    <%: Scripts.Render("~/Scripts/AdminBase") %>
    
    
    

    <script type="text/javascript" language="javascript">

        function FileSize(length)
        {
            var l;
            if (length < 1024)
            {
                l = length + " B";
            }
            else if (length < 1048576) //1048576=1024 * 1024
            {
                l = (length / 1024).toFixed(2) + " KB";
            }
            else
            {
                l = (length / 1048576).toFixed(2) + " MB";
            }
            document.write(l);
        }

        $(document).ready(function ()
        {
            
        });
        function upload()
        {
            $("#dialog-modal").dialog({
                height: 340,
                width: 540,
                title: "文件上传",
                modal: true
            });
            var urlC = $("#dialog-modal-url");
            urlC.attr("src", "../window/UpLoad.aspx?dir=" + escape($("#txtDir").val()));
            urlC.width(500);
            urlC.height(500);
        }
    </script>

    <style type="text/css">
        boby
        {
            margin:0px;
        }
        .JvZhong
        {
            height: 120px;
            width: 400px;
            position: absolute;
            left: 232px;
            top: 108px;
            margin-right: auto;
            margin-bottom: auto;
            margin-left: auto;
            background-color: #FFFFCC;
            padding: 6px;
         
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server">
        <ProgressTemplate>
            <uc1:UC_AjaxLoading ID="UC_AjaxLoading1" runat="server" />
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        <div align="center" style="width:99%">
                路径：<asp:TextBox ID="txtDir" runat="server" Width="500px"></asp:TextBox>
                <asp:Button ID="btnGoTo" runat="server" OnClick="btnGoTo_Click" Text="转到" Cssclass="btn btn-default" />
            <input type="button" onclick="upload();" class="btn btn-default" value="上传" />
            </div>
            <div style="text-align: left">
                <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                    <tr>
                        <td style="width: 180px" valign="top">
                            <div style="overflow: scroll; width: 180px; height: 480px">
                                <asp:GridView ID="GV_Directory" runat="server" AutoGenerateColumns="False" GridLines="None" CssClass="table table-bordered table-condensed table-hover"
                                    OnRowCommand="GV_Directory_RowCommand" Width="160px">
                                    <Columns>
                                        <asp:TemplateField HeaderText="目录" ShowHeader="False">
                                            <ItemTemplate>
                                                <img onerror="this.src='../Images/FileICO/err.gif'" src="../Images/FileICO/folder.gif" alt="" />
                                                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" CommandName="GoTo"
                                                    Text='<%# Eval("key") %>' CommandArgument='<%# Eval("value") %>'></asp:LinkButton>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <HeaderStyle CssClass="HeaderStyle" />
                                </asp:GridView>
                            </div>
                        </td>
                        <td valign="top">
                            <asp:GridView ID="GV_List" runat="server" AutoGenerateColumns="False" GridLines="None" CssClass="table table-bordered table-striped table-condensed table-hover"
                                OnRowDeleting="GV_List_RowDeleting" AllowPaging="True" PageSize="20" OnRowCommand="GV_List_RowCommand"
                                DataKeyNames="FullName" AllowSorting="True" OnSorting="GV_List_Sorting" >
                                <HeaderStyle CssClass="HeaderStyle"></HeaderStyle>
                                <Columns>
                                    <asp:TemplateField HeaderText="名称">
                                        <ItemTemplate>
                                            <div style="float: left;">
                                                <img src="../Images/FileICO/<%# Eval("Extension").ToString().TrimStart('.') %>.gif" onerror="this.src='../Images/FileICO/err.gif'" alt="" />
                                                <a href="FileEditor.aspx?dir=<%# Server.UrlEncode(Eval("FullName").ToString()) %>" target="_blank" title='文件大小：<%# WinnerCMS.Common.FileIO.FileSize((long) Eval("Length")) %>'>
                                                    <%# Eval("Name") %></a><a href="DownloadFile.aspx?dir=<%# Eval("FullName") %>" target="_blank">
                                                <img src="../Images/FileICO/download.png" alt="" /></a>
                                            </div>
                                            <div style="float: right;">
                                                <asp:Button ID="btnCFile" runat="server" Text="解压" CommandName="CFile" CommandArgument='<%# Eval("FullName") %>'
                                                    Cssclass="btn btn-default" Visible='<%# CFile(Eval("FullName")) %>' /></div>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    
                                    
                                    <asp:ButtonField CommandName="Move" HeaderText="移动/重命名" Text="移动/重命名">
                                        <ItemStyle HorizontalAlign="Center" Width="80px" />
                                    </asp:ButtonField>
                                    <asp:TemplateField HeaderText="删除" ShowHeader="False">
                                        <ItemTemplate>
                                            <asp:ImageButton ID="IB_Delete" runat="server" CausesValidation="False" 
                                                CommandName="Delete" OnClientClick="return confirm('您确定要删除？');" ImageUrl="../Images/del.gif" Text="" />
                                        </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Center" Width="34px" />
                                    </asp:TemplateField>
                                    <asp:BoundField HeaderText="最后修改" DataField="LastWriteTime" DataFormatString="{0:yyyy-MM-dd HH:mm:ss}"
                                        HtmlEncode="False" SortExpression="LastWriteTime">
                                        <ItemStyle HorizontalAlign="Center" Width="118px" />
                                    </asp:BoundField>
                                </Columns>
                                <PagerSettings Visible="False" />
                            </asp:GridView>
                            <cc1:PageNavigation ID="PageNavigation1" runat="server" OnPageChanging="PageNavigation1_PageChanging"
                                PageSize="20" Width="100%" SubmitButtonclass="btn btn-default">
                            </cc1:PageNavigation>
                        </td>
                    </tr>
                </table>
            </div>
            
            <asp:Panel ID="Panel1" runat="server" CssClass="JvZhong" Visible="False" Style="left: 256px;
                top: 175px">
               
                旧：
                <asp:TextBox ID="txtOldFilePath" runat="server" Width="280px" ReadOnly="True"></asp:TextBox>
                <br /><br />
                新：
                <asp:TextBox ID="txtFilePath" runat="server" Width="281px" ValidationGroup="Mid_File"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtFilePath"
                    ErrorMessage="请输入" ValidationGroup="Mid_File"></asp:RequiredFieldValidator><br /><br />
                <asp:Button ID="btnOK" runat="server" EnableViewState="False" Text="修改" OnClick="btnOK_Click"
                    ValidationGroup="Mid_File" Cssclass="btn btn-default" /> 
                <asp:Button ID="btnCancel" runat="server" EnableViewState="False" OnClick="btnCancel_Click"
                    Text="取消" Cssclass="btn btn-default" /> </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
     
    </form>
        <div id="dialog-modal">
        <iframe id="dialog-modal-url" frameborder="0" scrolling="no"></iframe>
    </div>
</body>
</html>
